<style lang="less">
    .box-div {
        margin-top: -20px;
        .ivu-table:before {
            background-color: transparent
        }
    }
</style>
<template>
    <div class="box-div">
        <Table no-data-text="亲，没有多个退款单哦！~" :columns="columns1" :data="data1" :show-header="false"></Table>
        <RebateModaIteml ref="rebateDetailsModal" />
    </div>
</template>
<script>
import RebateModaIteml from './RebateModaIteml'
import { renderButton} from '@/util'
export default {
    props: {
        row: Object
    },
    components: { 
        RebateModaIteml
    },
    data () {
        return {
            columns1: [
                {
                    key: 'afterSaleNo',
                    align: 'left',
                    minWidth: 200,
                    render: (h, params) => {
                        return ( <div> 
                            {
                                h('span', {
                                    style: {
                                        color: '#21a4ff',
                                        'margin-right':'10px'
                                    }
                                }, params.row.afterSaleNo)
                            }
                            {
                                renderButton (h, { text: '详情', type: 'primary' },
                                () => { 
                                    this.onDetails({
                                        row: params.row,
                                        type: 'refund'
                                    })
                                })
                            } 
                            </div>
                        )
                    }
                },
                {
                    key: 'refundTime',
                    align: 'left',
                    minWidth: 200
                },
                {
                    key: 'refundRebate',
                    align: 'left',
                    render: (h, p) => {
                        let text = '-' + p.row.refundRebate
                        return h('div', text)
                    }
                }
            ],
            data1: []
        }
    },
    mounted () {
        this.data1 = this.row.purchOrderRefunds
    },
    methods: {
        onDetails(row) {
            this.$refs.rebateDetailsModal.open(row)
        }
    }
}
</script>